package com.lsc.study.datastruct;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;

public class PropertiesDemo {


    public static void main(String[] args) throws IOException {

        Properties properties = new Properties();
        /* 为 配置类 添加 值  */
        properties.setProperty("name", "hanamaki");
        properties.setProperty("age", "100");
        properties.setProperty("sex", "1");

        System.out.println(properties);

        /* 如何 取值  */
        String age = properties.getProperty("age");
        System.out.println(age);

        FileOutputStream fileOutputStream = new FileOutputStream("D:\\info.txt");
        /* 将 当前配置 对象 Properties 中的信息保存到本地电脑的磁盘目录中  */
        properties.store(fileOutputStream, "hanamaki");




    }
}
